package org.jeecg.modules.api.officebalancelog.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.jeecg.modules.api.officebalancelog.entity.OfficeBalanceLog;
import org.jeecg.modules.api.sourcemember.entity.SourceMember;

import java.util.List;

/**
 * @Description: lkd_sys_user
 * @Author: jeecg-boot
 * @Date:   2024-09-18
 * @Version: V1.0
 */
public interface OfficeBalanceLogMapper extends BaseMapper<OfficeBalanceLog> {
    @Select("SELECT count(1) FROM t_order WHERE user_id in (${ids}) and  status=4 and service_type=0 and create_date>=#{startTime} and create_date<=#{endTime}")
    public int validCount(@Param("ids") String userIds, @Param("startTime")String startTime,@Param("endTime") String endTime);

    @Select("SELECT id FROM t_order WHERE status=4 and service_type=0 and fx_state=0 and refund_id is null and refund_status is null ")
    public List<String> getFxOrderList();

    @Update("update t_order set fx_state=#{state} WHERE id=#{id} and fx_state=#{preState}")
    public int updateOrderStatus(@Param("id")String id, @Param("preState")int preState, @Param("state")int state);

}
